package cn.io0288.blog2.model;

import java.sql.ResultSet;
import java.sql.SQLException;

public class User {
    public int uid;
    public String uname;
    public String uemail;
    public String upassword;

    public User(String uemail, String upassword) {
        this.uemail = uemail;
        this.upassword = upassword;
    }

    public User(ResultSet rs) throws SQLException {
        this.uid = rs.getInt("uid");
        this.uname = rs.getString("uname");
        this.uemail = rs.getString("uemail");
        this.upassword = rs.getString("upasswd");
    }

    public String toString(){
        return ("User{uid:%d, uname:%s, uemail:%s, upassword:%s}").formatted(
                this.uid, this.uname, this.uemail, this.upassword
        );
    }
}
